{% if mode == 'short' %}
    <table class="shorttablearticle">
        <tr>
            <td class="image">
                {% set imgs = article.images|slice(0,1) %}
                {% for image in imgs %}
                    <a href="{{ asset(['bundles/lpcisiiphp2012/images/', image.url ]|join) }}" rel="lightbox">
                        <img src="{{ asset(['bundles/lpcisiiphp2012/images/', image.url ]|join) }}" alt="{{ image.titre }}"/>
                    </a>
                {% endfor %}
            </td>
            <td class="nomarticle">
                <a href="{{ path('LPCISIIPHP2012Bundle_article', {'reference': article.reference, 'mode': 'detailed'}) }}">{{ article.nom | slice(0, 100) }}
                {% if article.nom|length > 100 %}...
                {% endif %}
                </a>
            </td>
            <td class="prix">{{ article.prix }}€</td>
            <td>
                {% if is_granted('ROLE_ADMIN') %}
                    <td>
                        <a href=" {{ path('LPCISIIPHP2012Bundle_admin_del_article', { 'reference' : article.reference } ) }}">
                            Supprimer
                        </a>
                    </td>
                    <td>
                        <a href="{{ path('LPCISIIPHP2012Bundle_admin_mod_article', { 'reference' : article.reference } )}}">
                            Modifier
                        </a>
                    </td>
                {% else %}
                <a href=" {{ path('LPCISIIPHP2012Bundle_add_article', { 'reference' : article.reference } ) }}">
                    Ajouter au panier
                </a>
                {% endif %}
            </td>
        </tr>
    </table>
{% else %}
    {% block body %}
    <table class="detailedtablearticle">
        <tr>
            <th colspan="2">
                {{ article.nom }}
            </th>
        </tr>
        <tr>
            <td class="image" rowspan="4">
                {% set imgs = article.images|slice(0,1) %}
                {% for image in imgs %}
                    <a href="{{ asset(['bundles/lpcisiiphp2012/images/', image.url ]|join) }}" rel="lightbox[group]">
                        <img src="{{ asset(['bundles/lpcisiiphp2012/images/', image.url ]|join) }}" alt="{{ image.titre }}"/>
                    </a>
                {% endfor %}
            </td>
            <td>
                <label>Descriptif : </label>{{ article.descriptif }}
            </td>
        </tr>
        <tr>
            <td>
                <label>Poids : </label>{{ article.poids }}kg
            </td>
        </tr>
        <tr>
            <td>
                <label>Prix : </label>{{ article.prix }}€
            </td>
        </tr>
        <tr>
            <td>
                <label>Livré sous : </label>{{ article.delais }} jours
            </td>
        </tr>
        <tr>
            <td class="thumbimages">
                {% for image in article.images|slice(1) %}
                    <a href="{{ asset(['bundles/lpcisiiphp2012/images/', image.url ]|join) }}" rel="lightbox[group]">
                        <img src="{{ asset(['bundles/lpcisiiphp2012/images/', image.url ]|join) }}" alt="{{ image.titre }}"/>
                    </a>
                {% endfor %}
            </td>
            <td>
                <a href="{{ path('LPCISIIPHP2012Bundle_add_article', { 'reference' : article.reference } ) }}">
                    Ajouter au panier
                </a>
            </td>
        </tr>
    </table>
    {% endblock %}
{% endif %}
